package com.mikepenz.actionitembadge.library.utils;

import ohos.agp.components.AttrHelper;
import ohos.agp.components.Component;
import ohos.agp.components.element.Element;
import ohos.app.Context;

/**
 * Created by mikepenz on 02.07.15.
 */
public class UIUtil {
    /**
     * helper method to set the background depending on the ohos version
     * 设置背景颜色
     *
     * @param component
     * @param element
     */
    public static void setBackground(Component component, Element element) {
        component.setBackground(element);
    }

    /**
     * vp 转px
     *
     * @param context
     * @param dp
     * @return int
     **/
    public static int convertDpToPx(Context context, float dp) {
        return AttrHelper.vp2px(dp, context);
    }
}
